﻿package com.flashlit.shared.component
{
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFieldType;
	import mx.controls.TextArea;
	
	/**
	 * This class provides a simple workaround to let you set
	 * the <code.styleSheet</code> property of a TextArea control.
	 */
	public class StyledTextArea extends TextArea
	{
		/**
		 * Overrides the <code>TextArea.createChildren()</code>
		 * method to use a StyledUITextField object instead of
		 * a UITextField object.
		 */
		override protected function createChildren():void
		{
			textField = new StyledUITextField();
			
			textField.autoSize = TextFieldAutoSize.NONE;	
			textField.enabled = enabled;
			textField.ignorePadding = true;
			textField.multiline = true;
			textField.selectable = true;
			textField.styleName = this;
			textField.tabEnabled = true;
			textField.type = TextFieldType.INPUT;
			textField.useRichTextClipboard = true;
			textField.wordWrap = true;
	
            addChild(textField);
	
			super.createChildren();
		}
	}
}

